#include "Avalon/Codecs/Decoder.hpp"
#include "Avalon/IO/Buffer.hpp"

using namespace Avalon;
using namespace Avalon::Codecs;
using namespace Avalon::IO;

Decoder::~Decoder() {}

void Decoder::Decode(const Buffer& source, void* destination,
    int destinationSize, Out<int> decodedSize) {
  Decode(source.GetData(), source.GetSize(), destination, destinationSize,
    Store(decodedSize));
}

void Decoder::Decode(const Buffer& source, Buffer* destination,
    Out<int> decodedSize) {
  Decode(source.GetData(), source.GetSize(), destination, Store(decodedSize));
}

void Decoder::DecodeInPlace(void* data, int size, Out<int> decodedSize) {
  Decode(data, size, data, size, Store(decodedSize));
}

void Decoder::DecodeInPlace(Buffer* data, Out<int> decodedSize) {
  DecodeInPlace(data->GetMutableData(), data->GetSize(), Store(decodedSize));
}
